//
//  SplashViewController.m
//  DSNDialer
//
//  Created by Chris Morrell on 5/8/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "SplashViewController.h"
#import <MessageUI/MessageUI.h>
#import <MessageUI/MFMailComposeViewController.h>

@implementation SplashViewController
@synthesize emailButton;

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    [super viewDidLoad];
	self.view.backgroundColor = [UIColor clearColor];
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
	[self dismissModalViewControllerAnimated:YES]; 
}

-(IBAction)emailbuttonAction:(id)sender
{
	if (![MFMailComposeViewController canSendMail])
	{
		UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Your device is not configured to send e-mail." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
		[alert show];
		[alert release];
		return;
	}
	MFMailComposeViewController *mailComposer = [[MFMailComposeViewController alloc] init];
	mailComposer.mailComposeDelegate = self;
	[mailComposer setSubject:@"DSN Converter Support Request"];
	[mailComposer setToRecipients:[NSArray arrayWithObject:@"cfmorrellapps@gmail.com"]];
	mailComposer.view.backgroundColor = [UIColor clearColor];
	mailComposer.navigationBar.tintColor = [UIColor grayColor];
	mailComposer.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
	mailComposer.title = @"Support Request";
	[super presentModalViewController:mailComposer animated:YES];
	[mailComposer release];
}

- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error 
{	
	[self dismissModalViewControllerAnimated:YES];
}

- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
}

- (void)viewDidUnload {
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
	self.emailButton = nil;
}


- (void)dealloc {
    [super dealloc];
	[emailButton release];
}


@end
